package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.ChamberApplicationMapper;
import com.ruoyi.system.domain.ChamberApplication;
import com.ruoyi.system.service.IChamberApplicationService;

/**
 * 商会成员入会申请Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-06-26
 */
@Service
public class ChamberApplicationServiceImpl implements IChamberApplicationService 
{
    @Autowired
    private ChamberApplicationMapper chamberApplicationMapper;

    /**
     * 查询商会成员入会申请
     * 
     * @param id 商会成员入会申请主键
     * @return 商会成员入会申请
     */
    @Override
    public ChamberApplication selectChamberApplicationById(Integer id)
    {
        return chamberApplicationMapper.selectChamberApplicationById(id);
    }

    /**
     * 查询商会成员入会申请列表
     * 
     * @param chamberApplication 商会成员入会申请
     * @return 商会成员入会申请
     */
    @Override
    public List<ChamberApplication> selectChamberApplicationList(ChamberApplication chamberApplication)
    {
        return chamberApplicationMapper.selectChamberApplicationList(chamberApplication);
    }

    /**
     * 新增商会成员入会申请
     * 
     * @param chamberApplication 商会成员入会申请
     * @return 结果
     */
    @Override
    public int insertChamberApplication(ChamberApplication chamberApplication)
    {
        chamberApplication.setCreateTime(DateUtils.getNowDate());
        return chamberApplicationMapper.insertChamberApplication(chamberApplication);
    }

    /**
     * 修改商会成员入会申请
     * 
     * @param chamberApplication 商会成员入会申请
     * @return 结果
     */
    @Override
    public int updateChamberApplication(ChamberApplication chamberApplication)
    {
        chamberApplication.setUpdateTime(DateUtils.getNowDate());
        return chamberApplicationMapper.updateChamberApplication(chamberApplication);
    }

    /**
     * 批量删除商会成员入会申请
     * 
     * @param ids 需要删除的商会成员入会申请主键
     * @return 结果
     */
    @Override
    public int deleteChamberApplicationByIds(Integer[] ids)
    {
        return chamberApplicationMapper.deleteChamberApplicationByIds(ids);
    }

    /**
     * 删除商会成员入会申请信息
     * 
     * @param id 商会成员入会申请主键
     * @return 结果
     */
    @Override
    public int deleteChamberApplicationById(Integer id)
    {
        return chamberApplicationMapper.deleteChamberApplicationById(id);
    }
    //通过和拒绝的办法
    @Override
    public int approveChamberApplicationByIds(Integer[] ids) {
        return chamberApplicationMapper.updateAuditStatusByIds(ids, "已通过");
    }

    @Override
    public int rejectChamberApplicationByIds(Integer[] ids) {
        return chamberApplicationMapper.updateAuditStatusByIds(ids, "已拒绝");
    }

}
